


#ifndef DOOR_H
#define DOOR_H



#include <stdint.h>
#include <list>
#include "subject.h"



class Door : public Subject
{
public:        
    Door( uint8_t num, bool safe, bool truth, Color::eColor col );
    
    uint8_t getNumber() const { return m_nNumber; }
    bool isSafe() const { return m_bPendingSafe; }
    bool hasSign() const { return m_bHasSign; }
    void setSign( bool has ) { m_bHasSign = has; }
    void makeSafe() { m_bPendingSafe = m_bSafe = true; }
    bool isEven() const { return m_nNumber % 2 == 0; }
    
    virtual bool isLikeInitial() const; //< \return true if safe == pendingsafe
    /// mutates the door and returns true if the door returns to initial state
    virtual bool mutate(); 
    /// restores the door state to initial
    virtual void restore();
    
    virtual void putText( std::ostream &S ) const;
    
private:
    uint8_t m_nNumber;
    bool m_bSafe;
    bool m_bPendingSafe;
    bool m_bHasSign;
};
    
#endif
